package com.example.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.common.Result;
import com.example.entity.Relation;
import com.example.entity.Salesperson;
import com.example.service.RelationService;
import com.example.service.SalespersonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lmy
 * @since 2024-08-04
 */
@RestController
@RequestMapping("/relation")
@Api(description="联系表")
public class RelationController {
    @Autowired
    private RelationService relationService;
    @Qualifier("threadPoolExecutor01")
    @Autowired
    private ThreadPoolExecutor threadPoolExecutor;
    @GetMapping("/findAll")
    @ApiOperation(value = "查询所有客户经理")
    public Result list() {
        QueryWrapper<Relation> queryWrapper = new QueryWrapper<>();
        List<Relation> list = relationService.list(queryWrapper);
        return Result.ok().data("items", list);
    }
    @PostMapping("/addkhjl")
    @ApiOperation(value = "添加客户经理")
    public Result add_khjl(@RequestBody Relation relation) {

        boolean id =relationService.save(relation);

        if(id){
            return Result.ok();
        }else{
            return Result.error();

        }

    }


}
